using System.Reflection;
using System.Reflection.Metadata;
using System.Xml.Linq;
using System;
using Xunit;
using Recorder;
namespace RecorderTest
{
    public class TestFrame
    {
        [Fact]
        public void testScoreNoThrow()
        {
            Frame f=new Frame();
            Assert.Equal(0,f.getScore());
        }
        [Fact]
        public void TestAddOneThrow()
        {
            Frame f=new Frame();
            f.Add(5);
             Assert.Equal(5,f.GetScore());
        }
        [Fact]
 
       
        public void testSimpleSpare()
        {
            g.add(3);
            g.add(7);
            g.add(3);
            
            Assert.Equals(13,g.ScoreForFrame(1));
            Assert.Equals(2,g.getCurrentFrame());
        }
        public void testSimpleFrameAfterSpare()
        {
            g.add(3);
            g.add(7);
            g.add(3);
            g.add(2);
            Assert.Equals(13,g.ScoreForFrame(1));
            Assert.Equals(18,g.ScoreForFrame(2));
            Assert.Equals(3,g.getCurrentFrame());
        }
        public int ScoreForFrame(int theFrame)
        {
            int ball=0;
            int score = 0;
            for (int currentFrame=0;
            currentFrame <theFrame;
            currentFrame++
            )
            {
                int secondThrow=itsThrows[ball++];
                int firstThrow =itsThrows[ball++];
                int framescore =firstThrow + secondThrow;
                //spare needs next frames first throw 
                if (framescore ==10)
                score +=frameScore+itsThrows[ball];
                else
                score + =framescore;
                //score=firstThrow + secondThrow;
            }
            return score;
        }
       
    }
}